<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h1 id="title"></h1>
  <button id="btn">按钮</button>

  <script>
    //命令式编程（原生js）：每做一个操作，都是给计算机（浏览器）一步步命令
    //声明式编程：

    //1.
    let message = "Hello World";
    
    //2.
    const titleEl = document.getElementById('title')
    titleEl.innerHTML = message

    //3.
    const btnEl = document.getElementById('btn')
    btnEl.addEventListener('click', e => {
      message = 'Hello React';
      titleEl.innerHTML = message
    })
  </script>
</body>
</html>